package com.hangwei.paperless;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.FrameLayout;

import com.hangwei.paperless.view.BaseView;
import com.hangwei.paperless.view.window.AcceptCheckSee;
import com.hangwei.paperless.view.window.AssemblyRecordSee;
import com.hangwei.paperless.view.window.BasicInfoSee;
import com.hangwei.paperless.view.window.BreakDownSee;
import com.hangwei.paperless.view.window.CheckSee;
import com.hangwei.paperless.view.window.CleanSee;
import com.hangwei.paperless.view.window.FinalCheckSee;
import com.hangwei.paperless.view.window.SubProcessSee;
import com.hangwei.paperless.view.window.TestSee;
import com.hangwei.paperless.widget.PicDialog;
import com.twelve.all.base.BaseActivity;

import java.util.ArrayList;

/**
 * Created by 张龙臣 on 2020/11/23.
 */

public class MainSeeActivity extends BaseActivity {

    private String mBillId;
    private PicDialog mPicDialog;

    public String getBillId() {
        return mBillId;
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_see);
        findViewById(R.id.view0).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        FrameLayout flContainer = findViewById(R.id.flContainer);
        int index = getIntent().getIntExtra("index", 0);
        mBillId = getIntent().getStringExtra("billId");
        BaseView baseView = null;
        switch (index) {
            case 0:
                baseView = new BasicInfoSee(this);
                break;
            case 1:
                baseView = new AcceptCheckSee(this);
                break;
            case 2:
                baseView = new BreakDownSee(this);
                break;
            case 3:
                baseView = new CleanSee(this);
                break;
            case 4:
                baseView = new CheckSee(this);
                break;
            case 5:
                baseView = new SubProcessSee(this);
                break;
            case 6:
                baseView = new AssemblyRecordSee(this);
                break;
            case 7:
                baseView = new TestSee(this);
                break;
            case 8:
                baseView = new FinalCheckSee(this);
                break;
        }
        if (baseView != null) {
            flContainer.removeAllViews();
            flContainer.addView(baseView.getItemView());
        }
    }

    public void showBigPic(ArrayList<String> data, int position) {
        Intent intent = new Intent(this, BigPicActivity.class);
        intent.putExtra("list",data);
        intent.putExtra("position",position);
        startActivity(intent);
//        if (mPicDialog == null)
//            mPicDialog = PicDialog.newInstance((ArrayList<String>) data, position);
//        mPicDialog.show(getSupportFragmentManager(), "sasasas");
//        if (mPicDialog.isVisible()) {
//            mPicDialog.setStatus(data, position);
//        } else {
//        }
    }
}
